<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var num = prompt('请输入班级的总人数:')
        var sum = 0;
        var cf = 0;
        for (var i = 1; i <= num; i++) {
            var change = prompt('请输入第' + i + '学生的分数')

                //字符串转换成数字（分数有可能是小数）！！！！！
            sum = sum + parseFloat( change); 
        }
        cf = sum / num;
        alert('班级总成绩是:' + sum);
        alert('班级平均分是:' + cf);


    </script>
</body>

</html>